/************************************************************************************************
 * test examples of 100 interesting program in C
 * test 053_054.c
 * dilemma of the doctor (the honest, liar and double-dealer)
 * test of 054
 ***********************************************************************************************/

#include <stdio.h>

/*
 * the honest will always tell himself as honest
 * the liar will never tell himself as liar (that will lead to a paradox)
 */

int main()
{
	// 0 for liar, 1 for honest, 2 for double-dealer
	int a = 0, b = 0, c = 0;
	for (a = 0; a < 3; a++)
		for (b = 0; b < 3; b++)
		// to be caution, any judgement leading to "continue" but break
		// should not be placed in for judgement
		{
			if (a == b) continue;
			for (c = 0; c < 3; c++)
			{
				if (b == c || a == c) continue;
				if (
					((a == 0 && a != 1) || (a == 1 && a == 1) || (a == 2)) &&
					// if b is liar, he will never tell himself as a liar
					// so after first 2 judgement, he's obviously a double-dealer
					((b == 0 && 0) || (b == 1 && b == 0 && a == 1) || (b == 2 && ((b == 0 && a != 1) || (b != 0 && a == 1)))) &&
					((c == 0 && c != 1 && a != 2) ||
						(c == 1 && c == 1 && a == 2) ||
						(c == 2 && ((c != 1 && a == 2) || (c == 1 && a != 2))))
					)
					printf("%d-%d-%d\n", a, b, c);
			}
		}
}

